import "../css/index.css";
import "../css/map.css";

import img from "../img/christmas.png";
import img2 from "../img/windmill.png";
import {MapView} from "./core/MapView";
import {TMSLayer} from "./layer/TMSLayer";
import {Screen} from "./tool/Screen";
import {EXTENDS_3857, SCALE} from "./core/Constant";
import {WMSLayer} from "./layer/WMSLayer";
import {GraphicLayer} from "./layer/GraphicLayer";
import {Point} from "./geometry/Point";
import {Line} from "./geometry/Line";
import {Color} from "./other/Color";
import {Style} from "./geometry/style/Style";
import {LineStyle} from "./geometry/style/LineStyle";
import {PointStyle} from "./geometry/style/PointStyle";
import {Geometry} from "./geometry/Geometry";
import {Polygon} from "./geometry/Polygon";
import {PolygonStyle} from "./geometry/style/PolygonStyle";
import {FillStyle} from "./geometry/style/FillStyle";
import {Polyline} from "./geometry/Polyline";


let mapView = new MapView("map");
// mapView._mapRender.drawLine(0.5,0.5,-0.5,0.5,1,0,0);
// mapView._mapRender.drawPoint(0,1,10.0,1,1,0);
// mapView._mapRender.drawImage(img2,-0.5,-0.5,0.5,0.5);
// mapView._mapRender.drawImage(img,0.5,0.5,1,1);
let tmsLayer=new TMSLayer("http://www.google.cn/maps/vt?lyrs=r@189&gl=cn&x={x}&y={y}&z={z}",0);
mapView._layerManager.addLayer(tmsLayer);
// let wmsLayer=new WMSLayer("http://localhost:8080/geoserver/word/wms", "word:word",true,"1.1.1","image/png","3857");
// console.log(Screen.getDPM());
// mapView._layerManager.addLayer(wmsLayer);
let graphicLayer=new GraphicLayer();
for (let i = 0; i < 10; i++) {
    let numX=Math.random()*2-1;//-1到1随机数
    let numY=Math.random()*2-1;//-1到1随机数
    let point=new Point(EXTENDS_3857*numX,EXTENDS_3857*numY);
    point.setStyle(new PointStyle(15,Color.randomColor()));
    graphicLayer.addGeometry(point);
}
graphicLayer.setStyle(new PointStyle(15,new Color("#FF0000")));
mapView._layerManager.addLayer(graphicLayer);
// let graphicLayer2=new GraphicLayer();
// for (let i = 0; i < 4; i++) {
//     let line=Line.randomLine();
//     // line.setStyle(new LineStyle(Color.randomColor(),5,1));
//     graphicLayer2.addGeometry(line);
// }
// graphicLayer2.setStyle(new LineStyle(Color.randomColor(),5));
// mapView._layerManager.addLayer(graphicLayer2);
let layer3=new GraphicLayer();
for (let i = 0; i < 4; i++) {
    let polyline=Polyline.randomPolyline();
    // let  polyline=new Polyline([[-EXTENDS_3857,-EXTENDS_3857],[0,0],[-EXTENDS_3857,EXTENDS_3857]]);
    polyline.setStyle(new LineStyle(Color.randomColor(),4));
    layer3.addGeometry(polyline);
}
// layer3.setStyle(new LineStyle(Color.randomColor(),10));
// let style=new PolygonStyle(true,true,new FillStyle(Color.randomColor()),new LineStyle(Color.randomColor()));
// graphicLayer.setStyle(style);
mapView._layerManager.addLayer(layer3);

console.log(Math.atan(-1));











